All Questions
92 questions
6votes
2answers
232views
(HackerRank) Project Euler+ #250: 250250
Link to problem: linkNumber of solvers: 27 out of 844Solve rate (per person): 3.199%Success rate (over all submissions): 1.78% Project Euler+ on HackerRank is basically supposed to be a generalization ...
1vote
1answer
136views
Read millions of integers from stdin and process them in Python within 2 seconds
This is a competitive programming problem which has never been solved in Python within the time limit of 2 seconds. It is about Disjoint Set Union: Source: Algorithms In Context #10: Disjoint Sets ...
2votes
1answer
154views
LeetCode#494 target sum (dart is slower than python)
I'm trying to solve a LeetCode problem target-sum, in two languages: Python & Dart. The difference of time taken is shocking for me" Python took ~70ms while Dart took ~900ms !! Why does Dart ...
3votes
2answers
421views
Euler Project: Sums of Digit Factorials
MY CODE: ...
1vote
1answer
1kviews
Python IPv6 verifier, parser and converter
This is a simple Python 3 program that verifies whether a string is a valid IPv6 address or not, parses IPv6 address to its hexadecimal and decimal values, and converts an integer to IPv6 format. I am ...
1vote
0answers
126views
Python functions to serialize nested data structures human readably
See Serializing (nested) data structures in a human-readable format for more details. In the last two days I have significantly improved my function, and wrote seven implementations of it. I have ...
3votes
2answers
295views
Drug Analyzer challenge
What do I need help with? I'm doing the challenge below, in which I need to increase code performance. It's currently at 63% and I need to increase it to at least 71% however I can't optimize more ...
4votes
2answers
202views
Bisection, linear recurrences and even Fibonacci numbers
So this code is yet another attempt at solving the second Project Euler problem to improve my handling of Python. The purpose of the code is to solve the problem below Each new term in the Fibonacci ...
1vote
3answers
219views
Count prime numbers whose rotations are all prime
This code solves Project Euler problem 35: The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes ...
3votes
2answers
699views
Python 3 approximate pi using 9 algorithms
Note: this script requires gmpy2, if you are using Python 3.9.5 x64 on Windows 10 21H1 like me, then you need to download the pre-built ...
6votes
2answers
1kviews
Python Place +,-, nothing between 1, 2, …, 9 (in this order) whose sum is 100
So this is a programming challenge I saw: Write a program that outputs all possibilities to put + or - or nothing between the numbers 1,2,…,9 (in this order) such that the result is 100. For example ...
3votes
1answer
540views
Python script that converts Windows Registry Scripts (.reg) into PowerShell scripts (.ps1)
Well this a re-implementation of a PowerShell script that I wrote which does exactly the same thing, and I have ported it into Python. After a quick Google search I found that there is only one other ...
2votes
1answer
424views
Find sub-list index with the closest to a given number sum
The task that I have to perform is to take an array of a specific length, and figure out which sub-list has the closest sum to another given number. Then, I need to print the index of that sub-array. ...
26votes
2answers
6kviews
Printing 1,000,000 numbers in 1 sec. in Python
Here's a fairly simple task from CSES Problem Set - Permutations 1070 that reads: A permutation of integers 1,2, …, n is called beautiful if there are no adjacent elements whose difference is 1. ...
2votes
1answer
91views
Program to move in a 2d array given instructions, array and starting position
Original problem (not in English): https://pokval21.kattis.com/problems/pokval21.robotdammsugaren How can my code be optimized? ...